﻿using System.Device.Location;
using System.Windows;
using System.Windows.Media;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Controls.Maps;
using Microsoft.Phone.Controls.Maps.Core;

namespace Skyhook.WindowsPhone.AtoB {
    public partial class MapRoute : PhoneApplicationPage {
        public MapRoute() {
            InitializeComponent();
        }

        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) {
            var coords = MainPage.PointsLog;
            var locationsList = new LocationCollection();
            foreach (var coord in coords) {
                locationsList.Add(new GeoCoordinate(coord.Latitude, coord.Longitude));
            }

            var polyline = new MapPolyline {
                Stroke = new SolidColorBrush(Color.FromArgb(255, 255, 0, 0)),
                Opacity = 50,
                Locations = locationsList
            };

            Map.Children.Add(polyline);
        }
    }
}